﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//From IRDev Library Project. 
//Mark Rowe and Daniel Turnell 
//Base Class library Extended Exception.  
namespace AutoDeploy.Common.Library
{
    [Serializable()]
    public class ExpandedException : Exception
    {
        //Leaving out since it isn't Biztalk
        public List<String> Messages { get; set; } 
        //Calling ClassName
        public string ClassName = string.Empty;
        //Calling MethodName
        public string MethodName { get; set; }
        //The input paramaters (in ToString() format)
        public string ParametersInput { get; set; }
        //More flexible than GUID or Int since both can be input as a string
        public string MessageID { get; set; }
        //Exception Reported
        public string TimeOfException = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
        //Has the Exception Been Reported
        public bool Reported { get; set; }

        public ExpandedException()
        {
            Reported = false;
        }
        //To String :)
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Expanded Error\n");
            sb.Append("Class" + ClassName + "\n");
            sb.Append("Method:" + MethodName + "\n");
            sb.Append("Parameters:" + ParametersInput + "\n");
            sb.Append("MessageID:" + MessageID + "\n");
            sb.Append("Reported:" + Reported + "\n");
            sb.Append("Time Of Exception:" + TimeOfException + "\n");
            sb.Append("Message:" + base.Message + "\n");
            return sb.ToString();
        }
    }
}
